package android.slc.box.core.property;

import android.slc.box.commonlibrary.compat.ValueWrap;
import javafx.beans.property.SimpleObjectProperty;

public class SimpleWrapObjectProperty<T> extends SimpleObjectProperty<ValueWrap<T>> {

    public SimpleWrapObjectProperty() {
        this(null);
    }

    public SimpleWrapObjectProperty(T initialValue) {
        super(new ValueWrap<>(initialValue));
    }

    public SimpleWrapObjectProperty(Object bean, String name) {
        super(bean, name);
    }

    public SimpleWrapObjectProperty(Object bean, String name, T initialValue) {
        super(bean, name, new ValueWrap<>(initialValue));
    }

    @Override
    public ValueWrap<T> get() {
        return super.get();
    }

    @Override
    public ValueWrap<T> getValue() {
        return super.getValue();
    }

    public void notifyChange() {
        setValuePlus(getValue().getData());
    }

    public T getValuePlus() {
        return getValue().getData();
    }

    public void setValuePlus(T value) {
        setValue(new ValueWrap<>(value));
    }
}
